import { cloneDeep } from 'lodash-es'
import { BwBwComNameEnum } from '../../../render/enums'

import { iconOptions } from './src/icon'
import { chartBarOptions } from './src/chartBar'
import { chartLineOptions } from './src/chartLine'
import { chartPieOptions } from './src/chartPie'

import type { BwDesignNodeComDefaultOptionModel } from '../../model'

/** 获取组件默认配置信息 */
export function getBwComDefaultConfig(comCode: BwBwComNameEnum) {
  const data: BwDesignNodeComDefaultOptionModel = {
    attrs: null,
    enableSlotList: null,
  }
  switch (comCode) {
    case BwBwComNameEnum.Icon: {
      data.attrs = cloneDeep(iconOptions.attrs)
      data.enableSlotList = cloneDeep(iconOptions.slotList)
      break
    }
    case BwBwComNameEnum.BwChartBar: {
      data.attrs = cloneDeep(chartBarOptions.attrs)
      data.enableSlotList = cloneDeep(chartBarOptions.slotList)
      break
    }
    case BwBwComNameEnum.BwChartLine: {
      data.attrs = cloneDeep(chartLineOptions.attrs)
      data.enableSlotList = cloneDeep(chartLineOptions.slotList)
      break
    }
    case BwBwComNameEnum.BwChartPie: {
      data.attrs = cloneDeep(chartPieOptions.attrs)
      data.enableSlotList = cloneDeep(chartPieOptions.slotList)
      break
    }
  }
  return data
}
